﻿#ifndef FORWARD_OFFER_H
#define FORWARD_OFFER_H

#include <QObject>
#include <QThread>
#include <QTcpServer>
#include <QQueue>
#include <QHostAddress>
#include <QtConcurrent>
#include <QTcpSocket>
#include <QSslSocket>
#include <QSslKey>
#include <Command.hpp>
#include <QJsonObject>
#include <QSslPreSharedKeyAuthenticator>
#include <QSslConfiguration>
#include "forward_task.h"

class Forward_Offer : public QTcpServer
{
    Q_OBJECT
public:
    explicit Forward_Offer(const QHostAddress& address,const QJsonObject& info,QObject *parent = nullptr);
    ~Forward_Offer();
protected:
    //处理新的连接
    void incomingConnection(qintptr socketDescriptor);
    
signals:
    //需要新的连接
    void addService(QJsonObject port);
private:
    QJsonObject m_ClientInfo;
    QHostAddress m_ClientAddress;
    QQueue<QSslSocket*> m_QueueSocket;
    
private slots:
    void RecycleSocket(QTcpSocket* socket);
};

#endif // FORWARD_OFFER_H
